<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>20_js书写位置-内部JavaScript-是写在head中还是body中</title>

        <script>
            var d1 = document.getElementById('d1');
            d1.style.color = 'green';
        </script>

    </head>
    <body>
        <div id="d1">马大哥你要坚强啊</div>



        <!-- 在实际的企业级开发中script标签 要放在body 结束标签的上面 -->
        <!-- <script>
            var d1 = document.getElementById('d1');
            d1.style.color = 'green';
        </script> -->

    </body>
</html>